<?php
class pactUser
{
    protected $_username;
    protected $_group;
    private $_bUserCanModifyIndicator = FALSE;
    private $_bUserCanViewPrivateIndicator = FALSE;
    private $_bUserCanAddIndicator = FALSE;
    private $_bUserCanDeleteIndicator = FALSE;
    private $_bUserAdminIndicator = FALSE;

    function getUserName(){
        return $this->_username;
    }
    function getUserGroup(){
        return $this->_group;
    }

    function setuser($USERNAME, $GROUPNAME){
        $this->_username = $USERNAME;
        $this->_group = $GROUPNAME;

        switch (strtolower($this->_group) ){
                case "administrator":
                    $this->_bUserAdminIndicator = TRUE;
                    $this->_bUserCanModifyIndicator = TRUE;
                    $this->_bUserCanViewPrivateIndicator = TRUE;
                    $this->_bUserCanAddIndicator = TRUE;
                    $this->_bUserCanDeleteIndicator = TRUE;
                    break;
                case "editor":
                    $this->_bUserAdminIndicator = FALSE;
                    $this->_bUserCanModifyIndicator = TRUE;
                    $this->_bUserCanViewPrivateIndicator = TRUE;
                    $this->_bUserCanAddIndicator = TRUE;
                    $this->_bUserCanDeleteIndicator = TRUE;
                    break;
                case "readonly":
                    $this->_bUserAdminIndicator = FALSE;
                    $this->_bUserCanModifyIndicator = FALSE;
                    $this->_bUserCanViewPrivateIndicator = TRUE;
                    $this->_bUserCanAddIndicator = FALSE;
                    $this->_bUserCanDeleteIndicator = FALSE;
                    break;
                case "readonly-restricted":
                    $this->_bUserAdminIndicator = FALSE;
                    $this->_bUserCanModifyIndicator = FALSE;
                    $this->_bUserCanViewPrivateIndicator = TRUE;
                    $this->_bUserCanAddIndicator = FALSE;
                    $this->_bUserCanDeleteIndicator = FALSE;
                    break;
            }
        }
        public function getUserIsAdmin(){
            return $this->_bUserAdminIndicator;
        }
        public function getUserCanModify(){
            return $this->_bUserCanModifyIndicator;
        }
        public function getUserCanViewPrivate(){
            return $this->_bUserCanViewPrivateIndicator;
        }
        public function getUserCanAdd(){
            return $this->_bUserCanAddIndicator;
        }
        public function getUserCanDelete(){
            return $this->_bUserCanDeleteIndicator;
        }

    }
?>
